//
//  ViewController.m
//  testGit
//
//  Created by 李亮 on 16/10/21.
//  Copyright © 2016年 CC. All rights reserved.
//

#import "ViewController.h"
#import "twoViewController.h"

@interface ViewController ()

@property (nonatomic,strong) UILabel * lab;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setUpUI];
}

- (void)setUpUI{
    
    UIButton * btn = [[UIButton alloc] init];
    
    btn.backgroundColor = [UIColor greenColor];
    
    btn.frame = CGRectMake(200, 200, 100, 100);
    
    [btn addTarget:self action:@selector(btnclick:) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:btn];
    
    
}

- (void)btnclick:(UIButton *)btn{
    
    twoViewController * vc = [[twoViewController alloc] init];
    
    UILabel * lab = [[UILabel alloc] init];
    
    lab.backgroundColor = [UIColor blueColor];
    
    lab.frame = CGRectMake(20, 20, 100, 40);
    
    [self.view addSubview:lab];
    
    [btn addTarget:self action:@selector(btnclick:) forControlEvents:UIControlEventTouchUpInside];
    
//    self.lab = lab;
    
    vc.tblock = ^(NSString * str){
        
        lab.text = str;
        
    };
    
    [self presentViewController:vc animated:YES completion:nil];
    NSLog(@"------");
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
